home *** CD-ROM | disk | FTP | other *** search
/ A.C.E. 2 / ACE CD 2.iso / FILES / UTILS / AMOSPRO4.DMS / in.adf / Tutorials / Menus / Menus_5.AMOS / Menus_5.amosSourceCode
Encoding:
AMOS Source Code  |  1992-09-28  |  5.0 KB  |  176 lines

  1. '*************************** 
  2. '*    AMOS Professional    * 
  3. '*                         * 
  4. '*         MENUS 5         * 
  5. '*                         *               Embeded menu commands 
  6. '* (c) Europress Software  * 
  7. '*                         * 
  8. '*     Ronnie Simpson      * 
  9. '*************************** 
  10. '
  11. '------------------------------------------- 
  12. 'There are a total of 14 instructions which allow changes to be made to the
  13. 'appearance of your menus, each instruction requires only the first two
  14. 'letters of the command (either upper or lower case) and any extra will be 
  15. 'ignored.
  16. 'Most embeded commands also require parameters which must be input as numbers
  17. 'as expressions will not be evaluated. 
  18. '
  19. '
  20. 'BOB  (draw a bob) 
  21. '
  22. 'BO x  draws bob number x at the current cursor position, no account is
  23. 'taken of the bobs hot spot. 
  24. '
  25. '  
  26. 'ICON
  27. '
  28. 'IC x  draws icon number x at the current cursor position. 
  29. '
  30. 'LOCATE
  31. '
  32. 'LO x,y  moves graphic cursor to the given coordinates relative to the top 
  33. 'left hand corner of the menu bar. 
  34. '
  35. '
  36. 'INK 
  37. '
  38. 'IN c,t  assigns the colour index c  
  39. '
  40. '       if t=1 set foregrond colour
  41. '       if t=2 set paper colour
  42. '       if t=3 set outline colour
  43. '
  44. '
  45. 'SFONT 
  46. '
  47. 'SF x  set font to graphics font number x to be used in all future menu  
  48. '      items. Please note that a call to Get Fonts must be made before 
  49. '      this instruction can be used. 
  50. '
  51. '
  52. 'SStyle
  53. '
  54. 'SS x  sets the style of the current font to the bit pattern given in x  
  55. '
  56. '       bit 0 set (+1)  then underline 
  57. '       bit 1 set (+2)  then select bold characters  
  58. '       bit 2 set (+4)  then enter italics mode
  59. '
  60. '
  61. 'LINE
  62. '
  63. 'LI x,y  draws a line to x,y from current cursor position. 
  64. '
  65. '
  66. 'SLINE 
  67. '
  68. 'SL x  sets the pattern of line to be used where x is a 16 bit pattern 
  69. '      converted to decimal. (see graphics command Set Line for more 
  70. '      information.
  71. '
  72. '
  73. 'BAR 
  74. '
  75. 'BA x,y  draw a rectangle from current cursor position to x,y  
  76. '
  77. '
  78. 'PATTERN 
  79. '
  80. 'PA x   set fill pattern to number x 
  81. '
  82. '
  83. 'OUTLINE 
  84. '
  85. 'OU x   if x=1 outline mode on.     if x=0  outline mode off 
  86. '
  87. '
  88. 'ELLIPSE 
  89. '
  90. 'EL r1,r2  draw an ellipse at current cursor position using radii r1 and r2, 
  91. '          to draw a circle set r1 and r2 to equal values. 
  92. '
  93. '
  94. 'PROC
  95. '
  96. 'PR NAME  call procedure NAME from within a menu item. 
  97. '
  98. '
  99. 'RESERVE 
  100. '
  101. 'RE x   reserve x number of bytes of memory for a menu item
  102. '
  103. '
  104. '------------------------------------------- 
  105. 'WORKING EXAMPLE 
  106. '------------------------------------------- 
  107. Load "AMOSPro_Tutorial:Objects/Menu_Bobs.abk"
  108. '
  109. Rem *** tidy up the screen 
  110. '
  111. Screen Open 0,640,200,16,Hires
  112. Get Sprite Palette 
  113. Flash Off : Curs Off : Cls 0 : Pen 0 : Paper 11
  114. '
  115. Rem *** set the menu titles
  116. '
  117. Menu$(1)="     CONTROL                "
  118. Menu$(2)=" DEMO ITEMS                "
  119. Menu$(3)=" COLOURS"
  120. '
  121. Rem *** set the options with embedded commands 
  122. '
  123. Menu$(1,1)="       Quit      "
  124. '
  125. Menu$(2,1)="(LO 16,2)  CIRCLE  (LO 120,5)(IN 1,5)(EL 6,3)","(IN 1,8)(LO 120,5)(EL 6,3)"
  126. Menu$(2,2)="(LO 16,5)  ELLIPSE (LO 120,8)(IN 1,5)(EL 12,3)","(IN 1,8)(LO 120,8)(EL 12,3)"
  127. Menu$(2,3)="(LO 16,5)  OUTLINE (OU 1)(IN 1,0)(IN 3,5)(LO 105,4)(BA 135,14)","(IN 8,3)(IN 1,0)(LO 105,4)(BA 135,14)"
  128. Menu$(2,4)="(LO 16,5)  PATTERN (PA 5)(IN 3,5)(IN 1,0)(LO 105,4)(BA 135,14)(PA 0)","(PA 6)(IN 3,8)(LO 105,4)(BA 135,14)(PA 0)"
  129. Menu$(2,5)="(LO 16,5)  BAR     (IN 1,5)(LO 105,5)(BA 135,13)","(IN 1,8)(LO 105,5)(BA 135,13)"
  130. Menu$(2,6)="(LO 16,5)  SLINE   (IN 1,5)(SL 61680)(LO 105,11)(LI 135,11)(SL 65535)","(IN 1,8)(SL 61680)(LO 105,11)(LI 135,11)(SL 65535)"
  131. Menu$(2,7)="(LO 16,15)  BOB    (IN 3,5)(IN 1,0)(LO 95,10)(BA 145,35)(LO 104,12)(BO 1)","(IN 3,8)(IN 1,0)(LO 95,10)(BA 145,35)(LO 120,12)(BO 1)"
  132. '
  133. Paper 0
  134. Pen 1 : Menu$(3,1)="RED    "
  135. Pen 2 : Menu$(3,2)="GREEN  "
  136. Pen 3 : Menu$(3,3)="BLUE   "
  137. Pen 4 : Menu$(3,4)="YELLOW "
  138. Pen 5 : Menu$(3,5)="MAGENTA"
  139. Pen 6 : Menu$(3,6)="CYAN   "
  140. Pen 7 : Menu$(3,7)="ORANGE "
  141. '
  142. '
  143. Rem *** start the automatic checking 
  144. '
  145. Menu On 
  146. On Menu Proc CONTROL,DEMOS,KOLOURS
  147. On Menu On 
  148. Pen 9 : Locate 0,23 : Centre "PRESS RIGHT MOUSE KEY TO SEE MENU"
  149. '
  150. Rem *** loop whilst waiting for menu 
  151. '
  152. Do 
  153. Loop 
  154. '
  155. Procedure CONTROL
  156.    Edit 
  157. End Proc
  158. '
  159. Procedure DEMOS
  160.    Cls 0,0,0 To 639,175
  161.    On Choice(2) Gosub 1,2,3,4,5,6,7
  162.    On Menu On : Pop Proc
  163.    1 For N=0 To 30 : X=Rnd(500)+50 : Y=Rnd(100)+50 : Circle X,Y,6 : Next : Return 
  164.    2 For N=0 To 30 : X=Rnd(500)+50 : Y=Rnd(100)+50 : Ellipse X,Y,24,6 : Next : Return 
  165.    3 For N=0 To 30 : X=Rnd(500)+50 : Y=Rnd(100)+50 : Box X,Y To X+30,Y+10 : Next : Return 
  166.    4 Set Pattern 1 : Set Paint 1 : For N=0 To 30 : Ink Rnd(15),Rnd(15),Rnd(15) : X=Rnd(500)+50 : Y=Rnd(100)+50 : Set Pattern Rnd(30)+3 : Bar X,Y To X+30,Y+10 : Next : Set Pattern 0 : Set Paint 0 : Return 
  167.    5 Set Paint 1 : For N=0 To 30 : X=Rnd(500)+50 : Y=Rnd(100)+50 : Ink ,,Rnd(15) : Bar X,Y To X+30,Y+10 : Next : Set Paint 0 : Return 
  168.    6 For N=0 To 30 : X=Rnd(250)+50 : Y=Rnd(50)+50 : Set Line Rnd(65000) : Draw X,Y To Rnd(250)+250,Rnd(50)+100 : Next : Set Line 65535 : Return 
  169.    7 For N=0 To 30 : X=Rnd(500)+50 : Y=Rnd(100)+50 : Paste Bob X,Y,1 : Next : Return 
  170. End Proc
  171. '
  172. Procedure KOLOURS
  173.    C=Choice(2)
  174.    Ink C : Pen C
  175.    On Menu On 
  176. End Proc